const Mock = require('mockjs')
const List = []
const count = 300

for (let i = 0; i < count; i++) {
  List.push(Mock.mock({
    id: '@increment',
    num: '@integer(8, 10)',
    school: '人工智能与大数据学院',
    'graden|1': ['2019', '2020', '2021', '2022'],
    'status|1': ['在籍', '休学', '退学'],
    name: Mock.mock('@name'),
    graduate_time: '@date',
    class: '@integer(1, 10)'
  }))
}

module.exports = [
  {
    url: '/vue-admin-template/student/list',
    type: 'get',
    response: config => {
      const { page = 1, limit = 20 } = config.query
      // 0 <= index < 20
      // page =2 limit =20
      // 20 <= index < 40
      const pageList = List.filter((item, index) => index < limit * page && index >= limit * (page - 1))
      return {
        code: 20000,
        data: {
          total: List.length,
          items: pageList
        }
      }
    }
  }
]
